package com.lion.ball.app.api.simple;

import com.chris.dev.base.libs.v1.http.protocols.HttpResult;
import com.chris.dev.base.libs.v1.http.results.PageResult;
import com.chris.dev.base.libs.v1.http.results.ValueResult;
import com.chris.libs.http.x.v1.NetApi;
import com.chris.libs.http.x.v1.normal.DefaultRetrofit;
import com.lion.ball.app.model.results.UaaAccountResult;

import java.util.List;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;

/**
 * @author Chris chan
 * Create on： 2025/2/17 13:42
 * Use for:
 * Explain:
 */
public class AccountSimpleApi extends NetApi {
    public static Service service = DefaultRetrofit.create("api/account/item/", Service.class);

    public interface Service {
        // 增
        @POST("add")
        Call<HttpResult<ValueResult<Boolean>>> add(@Body RequestBody body);

        // 删
        @POST("remove")
        Call<HttpResult<ValueResult<Boolean>>> remove(@Body RequestBody body);

        // 删
        @POST("removeByIds")
        Call<HttpResult<ValueResult<Boolean>>> removeByIds(@Body RequestBody body);

        // 改
        @POST("update")
        Call<HttpResult<ValueResult<Boolean>>> update(@Body RequestBody body);

        // 查
        @POST("findAll")
        Call<HttpResult<List<UaaAccountResult>>> findAll(@Body RequestBody body);

        // 查分页
        @POST("findPage")
        Call<HttpResult<PageResult<UaaAccountResult>>> findPage(@Body RequestBody body);

        // 搜索
        @POST("search")
        Call<HttpResult<PageResult<UaaAccountResult>>> search(@Body RequestBody body);
    }
}
/*
    // 使用方法
    // 工具类
    public static <T> void post(Call<NetResult<T>> call, View ownView, CompleteCallback<T> callback) {
        call.enqueue(new SuccessStatusNetCallback<>(callback).with(ownView));
    }

    // Presenter使用
    String token = TokenUtil.getAuthorization();
    RequestBody body = NetApi.postRequestObjBody(token, IdParam.create(12138L));
    DefaultHttp.post(RecItemSimpleApi.service.remove(body), ownView, new CompleteCallback<ValueResult<Boolean>>() {
        @Override
        public void complete(NetResponse<NetResult<ValueResult<Boolean>>> response, boolean isSuccess, ValueResult<Boolean> result) {
            if (isSuccess) {
                System.out.println(result.getValue());
            }
        }
    });
*/

